package com.hhsjdesign.dynamicui.core.property.widget;

import com.hhsjdesign.dynamicui.annoprocess.ADynamicUI
import com.hhsjdesign.dynamicui.annoprocess.AWidgetProperty
import com.hhsjdesign.dynamicui.core.property.WidgetSpecProperty
import com.hhsjdesign.dynamicui.core.widgetdata.WidgetTypeConst
import org.json.JSONObject

//横向网格
@ADynamicUI
@AWidgetProperty(WidgetTypeConst.GRID_HORIZONTAL)
class GridHWidgetProperty : WidgetSpecProperty {

    //横向间距
    var horizontalSpace: Int = 0;

    //纵向间距
    var verticalSpace: Int = 0;

    //纵向数量
    var columnNumber: Int = 1

    //行数
    var rowNumber: Int = 1

    //排列方式 ，横向自上而下，纵向自下而上
    var rankType: Int = 0

    //item 宽度
    var itemWidth: Int = 0

    //item 高度
    var itemHeight: Int = 0

    constructor(jo: JSONObject) : super(jo) {
        horizontalSpace = jo.optInt("horizontalSpace")
        verticalSpace = jo.optInt("verticalSpace")
        columnNumber = jo.optInt("columnNumber", 2)
        rowNumber = jo.optInt("rowNumber", 2)
        rankType = jo.optInt("rankType")
        itemWidth = jo.optInt("itemWidth")
        itemHeight = jo.optInt("itemHeight")
    }

}
